package org.example.fancystudy.LockSupport;

import java.math.BigDecimal;

/**
 * @author chaigq
 * @version 1.0
 * @date 2022/11/11 11:06
 */
public class LockSupportDemo3 {
    public static void main1(String[] args) {
//        Thread thread = new Thread(() -> {
//            try {
//                TimeUnit.SECONDS.sleep(1);
//            } catch (InterruptedException e) {
//                e.printStackTrace();
//            }
//
//            System.out.println(Thread.currentThread().getName() + "\t ----come in "+System.currentTimeMillis());
//            // 被阻塞到这里
//            LockSupport.park();
//            LockSupport.park();
//            System.out.println(Thread.currentThread().getName() + "\t ----被唤醒 "+System.currentTimeMillis());
//        }, "thread");
//        thread.start();
//
//        new Thread(() -> {
//            LockSupport.unpark(thread);
//            LockSupport.unpark(thread);
//            System.out.println(Thread.currentThread().getName()+"\t ----发出通知");
//        }, "thread2").start();


//        String string = "1234567";
//        System.out.println(sqlValidate(string));
//        String s = "200000001729510001_reverse.jpg";
//        String fileName = s.replaceAll("\\.","_");
//        System.out.println(fileName);
//        String[] fileNames = fileName.split("_");
//        String iconType = "";
//        iconType = fileNames[0];
//        System.out.println(iconType);
//        System.out.println(fileNames[1]);

//        String date = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
//        System.out.println(date);

//        Date date=new Date();
//        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//        String currentTime=sdf.format(date);
//
//        //String currentTime = TimeUtil.getCurrentDate();
//        //获取当前的时分
//        String currentTms = currentTime.substring(11, 16);
//        System.out.println(currentTms);

//        repayTrialCalcDetl.getTotalAmt().subtract(null == repayTrialCalcDetl.getZgFeeAmt() ? BigDecimal.ZERO : repayTrialCalcDetl.getZgFeeAmt()
//        ).subtract(null == repayTrialCalcDetl.getLateFeeAmt() ? BigDecimal.ZERO : repayTrialCalcDetl.getLateFeeAmt()
//        ).subtract(null == repayTrialCalcDetl.getFalseAmt() ? BigDecimal.ZERO : repayTrialCalcDetl.getFalseAmt()).setScale(2, BigDecimal.ROUND_HALF_UP));// 不含费用的金额
//        log.info("----setSetlRecvAmt----");

        BigDecimal total = new BigDecimal("303.73");
        BigDecimal zgFeeAmt = new BigDecimal("0.00");
        BigDecimal LateFeeAmt = new BigDecimal("0.00");
        BigDecimal FalseAmt = new BigDecimal("0.00");
        BigDecimal setlRecvAmt = total.subtract(null == zgFeeAmt ? BigDecimal.ZERO : zgFeeAmt)
                .subtract(null == LateFeeAmt ? BigDecimal.ZERO : LateFeeAmt)
                .subtract(null == FalseAmt ? BigDecimal.ZERO : FalseAmt).setScale(2, BigDecimal.ROUND_HALF_UP);

        System.out.println("----" + setlRecvAmt);

        //System.out.println(this.getClass().getSimpleName().concat(channelNo));
    }

    public static void main(String[] args) throws ClassNotFoundException {

        Class myClass = Class.forName("LockSupportDemo3");

        System.out.println("Class represented by myClass: " + myClass.toString());
        System.out.println("SimpleName of myClass: " + myClass.getSimpleName());

    }



    protected static boolean sqlValidate(String str) {
        str = str.toLowerCase();//统一转为小写
        //String badStr = "and|exec";
        //String badStr = "'|and|exec|execute|insert|select|delete|update|count|drop|chr|mid|master|truncate|char|declare|sitename|net user|xp_cmdshell|or|like";
        String badStr = "'|and|exec|execute|insert|create|drop|table|from|grant|use|group_concat|column_name|" +
                "information_schema.columns|table_schema|union|where|select|delete|update|order|by|count|*|" +
                "chr|mid|master|truncate|char|declare|or|;|-|--|+|,|like|//|/|%|#|=|=1|1=1";        //过滤掉的sql关键字，可以手动添加
        String[] badStrs = badStr.split("\\|");
        for (int i = 0; i < badStrs.length; i++) {
            if (str.indexOf(badStrs[i]) !=-1) {
                System.out.println("匹配到："+badStrs[i]);
                return true;
            }
        }
        return false;
    }
}
